package com.example.kingdeescan.utils;

/**
 * author  : zly
 * date    : 2020/7/10 16:29
 * desc    : 数据库连接配置类
 */
public class DBConfig {
    private String driver="net.sourceforge.jtds.jdbc.Driver";
    private String sqlCon;
    private String ip;
    private String dbUser;
    private String dbPwd;
    private String dbName;

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public String getDbUser() {
        return dbUser;
    }

    public void setDbUser(String dbUser) {
        this.dbUser = dbUser;
    }

    public String getDbPwd() {
        return dbPwd;
    }

    public void setDbPwd(String dbPwd) {
        this.dbPwd = dbPwd;
    }

    public String getDbName() {
        return dbName;
    }

    public void setDbName(String dbName) {
        this.dbName = dbName;
    }

    public String getDriver() {
        return driver;
    }

    public String getSqlCon() {
        return sqlCon;
    }

    public DBConfig() {
    }

    public DBConfig(String driver, String sqlCon, String ip, String dbUser, String dbPwd, String dbName) {
        this.driver = driver;
        this.sqlCon = sqlCon;
        this.ip = ip;
        this.dbUser = dbUser;
        this.dbPwd = dbPwd;
        this.dbName = dbName;
    }

    /**
     * 初始化数据库连接语句
     * @return
     */
    public void initSqlCon(){
        if (null!=getIp() && null!=getDbName()){
            this.sqlCon="jdbc:jtds:sqlserver://" + getIp() + ":1433/"+getDbName();
        }
    }
}
